# Common Issues and Solutions
## Model Loading Related Issues
### Model File Not Found
**Symptom:**
```plaintext
ERROR - Pose model not found: /path/to/model/yolov8n-pose.pt
ERROR - Classifier model not found: /path/to/model/fall_multi_person_model.pkl
```
**Solution:**
- Ensure `yolov8n-pose.pt`, `fall_multi_person_model.pkl`, `feature_scaler_multi.pkl` are all in the `model/` directory
- Check if file paths are correct, test with absolute paths
- First run can let the program auto-download YOLOv8 model (requires network connection)
## Camera Related Issues
### Camera Not Recognized
**Symptom:**
```plaintext
Warning: No available cameras detected
```
**Solution:**
- Check if camera is properly connected to USB port
- Use command to check if camera is recognized:
```bash
# Linuxls -la /dev/video*
# Use v4l2-ctl to list cameras
v4l2-ctl --list-devices
```
- Try other USB ports
- If still not working, use a USB hub with power
- Check if camera driver installation is needed
### Camera Footage Stuttering or High Latency
**Symptom:**
```plaintext
Detected frame delay exceeds 1 second, or camera preview footage is not smooth
```
**Cause Analysis:**
- Camera resolution too high causing processing delay
- High CPU usage
- Network upload blocking main thread
**Solution:**
- Reduce camera resolution (change to 1280×720 instead of higher)
- Adjust `DETECT_INTERVAL` parameter to increase detection interval:
```python
DETECT_INTERVAL = 0.25 # Increase from 0.15 to 0.25 seconds
```
- Reduce `YOLO_IMG_SIZE` to speed up inference:
```python
YOLO_IMG_SIZE = 320 # Can reduce to 256
```
- Disable server upload function for local testing
## Fall Detection Related Issues
### High False Alarm Rate (Normal Actions Detected as Falls)
**Symptom:**
```plaintext
Users bending over, sitting down or resting are incorrectly detected as falling
```
**Solution:**
1. **Adjust Classifier Confidence Threshold**: Increasing threshold can reduce false alarms
```python
FALL_MIN_CONFIDENCE = 0.80 # Increase from 0.75 to 0.80
```
2. **Increase Confirmation Frame Count**: Only judge as fall when detected in multiple consecutive frames
```python
FALL_CONFIRM_FRAMES = 5 # Increase from 3 to 5
```
3. **Optimize Angle and Ratio Thresholds**:
```python
FALL_BODY_ANGLE_THRESHOLD = 65 # Increase angle threshold
FALL_HEIGHT_RATIO_THRESHOLD = 1.4 # Increase height-to-width ratio threshold
```
4. **Retrain Classifier**: Use more diverse training data
- Add negative samples of sitting, bending over, etc.
- Ensure diversity of fall samples (different angles, speeds, people)
- Increase training dataset size
### High Miss Rate (Actual Falls Not Detected)
**Symptom:**
```plaintext
No alarm triggered when actual fall occurs
```
**Solution:**
1. **Lower Classifier Confidence Threshold**:
```python
FALL_MIN_CONFIDENCE = 0.65 # Lower from 0.75 to 0.65
```
2. **Decrease Confirmation Frame Count**:
```python
FALL_CONFIRM_FRAMES = 2 # Lower from 3 to 2
```
3. **Check Keypoint Detection Quality**:
```python
# Increase keypoint requirements or lower confidence threshold
MIN_CONFIDENCE = 0.3 # Lower from 0.4
MIN_KEYPOINTS = 8 # Lower from 10
```
4. **Optimize View Angle**: Ensure camera can see the entire body
- Camera should be 1-3 meters from user
- Camera installation height should be 1.5-2 meters
- Avoid side or near-vertical viewing angles
5. **Improve Lighting Conditions**:
- Ensure adequate lighting, avoid shadows and backlighting
- Use uniform ambient light instead of localized strong light
## Alarm and Upload Related Issues
### Alarm Light Not Activating
**Symptom:**
```plaintext
Fall detected but alarm light doesn't turn on
```
**Solution:**
- Check if serial port connection is correct
- Verify if alarm light device is working properly
- Check serial port configuration in `light_control.py`:
```python
port = '/dev/ttyUSB0' # Modify according to actual device
baudrate = 9600 # Modify according to device specifications
```
- Check serial port permissions:
```bash
sudo chmod 666 /dev/ttyUSB0
```
- Debug according to purchased alarm light documentation, ensure sent command format is correct
### Image Upload Failed
**Symptom:**
```plaintext
ERROR - Upload failed: fall_20240326_143022.jpg
```
**Cause Analysis:**
- Unstable network connection
- Wrong server address or server unavailable
- Request timeout
**Solution:**
- Check network connection: `ping SERVER_IP`
- Verify if server is running: `curl http://SERVER_IP:8000/upload_fall`
- Check firewall settings to allow outbound connections
- Modify server address:
```python
SERVER_IP = "your.server.ip"
```
## Performance Optimization Issues
### High CPU Usage
**Symptom:**
```plaintext
Application CPU usage > 80% during runtime, system response slow
```
**Solution:**
- Lower detection frequency (increase `DETECT_INTERVAL`)
- Reduce video resolution (change to 640×480 or lower)
- Disable real-time log display or reduce log update frequency
- Use GPU acceleration (if hardware supports)
### Memory Leak Causing Continuous Memory Increase
**Symptom:**
```plaintext
Application memory usage grows from 200MB to 1GB after running for several hours
```
**Solution:**
- Check if unreleased objects are created in loops
- Periodically clear log buffer:
```python
if len(LogManager._logs) > 100:
LogManager.clear_logs()
```
- Ensure threads are properly closed
- Use memory analysis tool to detect leaks: `python3 -m memory_profiler`
---
# Technical Support and Contributions
If you encounter any issues during use, please submit technical inquiries on the [Quectel Official Forum](). Our technical support team will respond promptly.
Project open-source repository: [https://github.com/Quectel-Pi/demo-fall-alarm-device]()
We welcome you to submit Issues to report problems or Pull Requests to contribute code improvements!